export class LogicDriver {
    private static actions: Function[] = [];

    static bindLogicLoop(action: Function) {
        this.actions.push(action);
    }

    static removeLogicLoop(action: Function){
        this.actions = this.actions.filter(a=>{
            return a != action
        })
    }

    static update() {
        for (let action of LogicDriver.actions) {
            try {
                action();
            } catch (e) {
                console.error(`逻辑帧执行异常！！！！,位于:${e.stack}/${e.message}`);
            }
        }
    }
}
